Chains = ds_map_create();

for (i = 0; i < ds_list_size(argument0); i+=1)
{
    current = ds_list_find_value(argument0, i);
    for (ii = 0; ii <= string_length(current) - 1; ii += 1)
    {
        substr = string_copy(current, ii, 2);
        
        if (ds_map_exists(Chains, substr))
        {
            curlist = ds_map_find_value(Chains, substr);
            
            str = string_copy(current, ii + 1, 2);
            
            if (str != "*")            
                ds_list_add(curlist, str);   
            ds_map_replace(Chains, substr, curlist);
        }
        else
        {
            list = ds_list_create();
            
            str = string_copy(current, ii + 1, 2);
            
            if (str != "*")                        
                    ds_list_add(list, str)
            ds_map_add(Chains, substr, list);
        }
    }
}

return Chains;
